A nonvolatile memory features non-volativity that information is not lost after a power failure. However, when a nonvolatile memory is used in a certain scenario where relatively high security is required, information stored in the nonvolatile memory after a power failure may risk a leakage.
A phase-change memory of the nonvolatile memory type is used as an example. A phase-change memory is a type of nonvolatile memory that stores information by using different states of a phase-change material. When the phase-change material is in a crystalline state, resistance is relatively small; when the phase-change material is in a non-crystalline state, resistance is relatively large. Corresponding data can be read by detecting a resistance of the phase-change material. Compared with an existing flash memory in the prior art, the phase-change memory has such advantages as quick read and write speeds, abrasion resistance, low power consumption, and high integration. At present, the phase-change memory is likely to replace the flash memory gradually. In the future, the phase-change memory is likely to replace a Dynamic Random Access Memory, DRAM as the memory of an electronic device. When a phase-change memory is used as the memory of an electronic device, to-be-sent original data can be encrypted and then sent or original data can be encrypted and then saved to a hard disk. However, when an application program in the electronic device uses the encrypted data, the electronic device usually implements decryption to obtain the original data and saves the original data to a memory to increase efficiency of reusing the original data later. That is, data in the memory is original data in plaintext. After the electronic device is powered off, if a person removes the phase-change memory used as a memory module and installs the phase-change memory to his/her own computer, the person can use a software tool to read and parse data in the phase-change memory to acquire the original data stored in the phase-change memory, and the original data may include information that needs to be kept secret, such as sensitive information of a user. This causes data stored in the phase-change memory to be relatively insecure.
It may be known based on the foregoing description that data stored in a nonvolatile memory is of poor security because of the non-volativity feature of the nonvolatile memory.